<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>Title</title>
</head>
<%--<link rel="stylesheet" href="/static/home.css">--%>
<link rel="stylesheet" href="/static/css/page.css">
<body>
<div class="user">
<div class="dropdown" style="float:right;">
    <button class="dropbtn">欢迎你${sessionScope.consumer.responseObject.consumerName}</button>
    <div class="dropdown-content" style="left:0;">
        <a href="/user/exit-login">退出登录</a>
    </div>
</div>
</div>
<div class="home" style="padding: 1% 1% 1% 11%">
    <a href="/user/get-all-consumer">返回首页</a>
</div>

<div class="row">
    <div class="column">
        <ul>
            <li><a class="active" href="/user/get-all-consumer">用户管理</a></li>
            <li><a href="/tag/get-all-tag">标签管理</a></li>
            <li><a href="/blog/get-all-blogInfo">博客管理</a></li>
            <li><a href="/document/get-all-document">文件管理</a></li>
            <li><a href="/report/get-all-reportInfo">举报处理</a></li>
        </ul>
    </div>
</div>
<div>
    <div style="margin-left:3%;height:1000px;">
        <div style="overflow-x:auto; padding-left: 3%">
            <c:if test="${not empty allConsumer}">

                <form action="/user/by-consumer-name-get-consumerInfo" method="post" style="padding-left: 25%">
                    <input name="consumerName" placeholder="输入用户名" class="middle1-search">
                    <input type="submit" value="搜索" class="middle1-submit">
                </form>

                <div class="parent">
                    <form action="/user/by-consumer-root-get-consumerInfo" method="post" id="consumerRoot">
                        <select name="consumerRoot" onchange="document.getElementById('consumerRoot').submit()">
                            <option>请选择</option>
                            <option value="0">普通用户</option>
                            <option value="1">管理员</option>
                            <option value="2">超级管理员</option>
                        </select>
                    </form>
                </div>

                <div class="parent">
                    <form action="/user/by-consumer-root-and-consumer-status-get-consumerInfo" method="post"
                          id="consumerRootAndConsumerRoot">
                        <select name="consumerStatus"
                                onchange="document.getElementById('consumerRootAndConsumerRoot').submit()">
                            <option value="0">启用</option>
                            <option value="1">停用</option>
                            <option value="2">冻结</option>
                        </select>
                    </form>
                </div>

                <div>
                    <a href="/user/consumer-add" class="admin-add">管理员添加</a>
                </div>
                <table class="blog-table">
                    <tr>
                        <th hidden>用户UUID</th>
                        <th>用户名</th>
                        <th>用户名密码</th>
                        <th>手机号码</th>
                        <th>用户邮箱</th>
                        <th>用户头像</th>
                        <th>用户权限</th>
                        <th>用户状态</th>
                        <th>用户注册时间</th>
                        <th>最后修改时间</th>
                    </tr>

                    <c:forEach items="${allConsumer}" var="c">
                        <form action="/user/update-consumerInfo" method="post">
                            <tr>
                                <td hidden>
                                    <input name="consumerUuid" value="${c.consumerUuid}" readonly>
                                </td>
                                <td>
                                    <input name="consumerName" value="${c.consumerName}" hidden>
                                    <a href="/user/by-consumer-uuid-get-consumerInfo?consumerUuid=${c.consumerUuid}">${c.consumerName}</a>
                                </td>
                                <td>${c.consumerPassword}</td>
                                <td>${c.phoneNumber}</td>
                                <td>${c.consumerEmail}</td>
                                <td>
                                    <a href="${c.consumerHeadPortrait}"><img src="${c.consumerHeadPortrait}" width="70px" height="40px"></a>

                                </td>
                                <td>
                                    <c:choose>
                                        <c:when test="${c.consumerRoot == 0}">
                                            <option>普通用户</option>
                                        </c:when>
                                        <c:when test="${c.consumerRoot == 1}">
                                            <option>管理员</option>
                                        </c:when>
                                        <c:when test="${c.consumerRoot == 2}">
                                            <option>超级管理员</option>
                                        </c:when>
                                    </c:choose>
                                </td>
                                <td class="blog">
                                    <c:choose>
                                        <c:when test="${c.consumerStatus == 0}">
                                            <option>启用</option>
                                        </c:when>
                                        <c:when test="${c.consumerStatus == 1}">
                                            <option>停用</option>
                                        </c:when>
                                        <c:when test="${c.consumerStatus == 2}">
                                            <option>冻结</option>
                                        </c:when>
                                    </c:choose>
                                    </select>
                                </td>
                                <td class="blog">${c.consumerRegistrationDate}</td>
                                <td class="blog">${c.tableUpdateDate}</td>
                            </tr>
                        </form>
                    </c:forEach>
                </table>

                <div class="center">
                    <div class="pagination">
                        <a href="/user/get-all-consumer?pageNum=1">1</a>
                        <a href="/user/get-all-consumer?pageNum=2">2</a>
                        <a href="/user/get-all-consumer?pageNum=3">3</a>
                        <a href="/user/get-all-consumer?pageNum=4">4</a>
                        <a href="/user/get-all-consumer?pageNum=5" class="active">5</a>
                        <a href="/user/get-all-consumer?pageNum=6">6</a>
                        <a href="/user/get-all-consumer?pageNum=7">7</a>
                        <a href="/user/get-all-consumer?pageNum=8">8</a>
                        <a href="/user/get-all-consumer?pageNum=9">9</a>
                    </div>
                </div>
            </c:if>

            <c:if test="${not empty allTag}">
                <div class="parent">
                    <form action="/tag/by-tag-status-get-all-tag" method="post" id="tagStatus">
                        <select name="tagStatus" onchange="document.getElementById('tagStatus').submit()">
                            <option>请选择</option>
                            <option value="0">未删除</option>
                            <option value="1">删除</option>
                        </select>
                    </form>
                </div>
                <form action="/tag/add-tag" method="post">
                    <input name="tagName" placeholder="请输入标签名" class="middle1-tag">
                    <input type="submit" value="添加标签" class="middle1-tag-submit">
                </form>

                <table>
                    <tr>
                        <th hidden>标签UUID</th>
                        <th>标签名</th>
                        <th>阅读量</th>
                        <th>标签状态</th>
                        <th>表修改时间</th>
                        <th>操作</th>
                    </tr>
                    <c:forEach items="${allTag}" var="a">
                        <tr>
                            <form action="/tag/update-tagInfo" method="post">
                                <td hidden>
                                    <input name="tagUuid" value="${a.tagUuid}" readonly>
                                </td>
                                <td class="data">
                                    <input name="tagName" value="${a.tagName}" hidden>
                                        ${a.tagName}
                                        <%--                                <a href="/tag/byTagUuidGetTagInfoVO?tagUuid=${a.tagUuid}">${a.tagName}</a>--%>
                                </td>
                                <td>${a.readCount}</td>
                                <td>
                                    <select name="tagStatus">
                                        <c:choose>
                                            <c:when test="${a.tagStatus == 0}">
                                                <option value="0">未删除</option>
                                            </c:when>
                                            <c:when test="${a.tagStatus == 1}">
                                                <option value="1">删除</option>
                                            </c:when>
                                        </c:choose>
                                        <option>请选择</option>
                                        <option value="0">未删除</option>
                                        <option value="1">删除</option>
                                    </select>
                                </td>
                                <td>${a.tableUpdateDate}</td>
                                <td>
                                    <input type="submit" value="修改">
                                </td>
                            </form>
                        </tr>
                    </c:forEach>

                </table>

                <div class="center">
                    <div class="pagination">
                        <a href="/tag/get-all-tag?pageNum=1">1</a>
                        <a href="/tag/get-all-tag?pageNum=2">2</a>
                        <a href="/tag/get-all-tag?pageNum=3">3</a>
                        <a href="/tag/get-all-tag?pageNum=4">4</a>
                        <a href="/tag/get-all-tag?pageNum=5" class="active">5</a>
                        <a href="/tag/get-all-tag?pageNum=6">6</a>
                        <a href="/tag/get-all-tag?pageNum=7">7</a>
                        <a href="/tag/get-all-tag?pageNum=8">8</a>
                        <a href="/tag/get-all-tag?pageNum=9">9</a>
                    </div>
                </div>
            </c:if>

            <c:if test="${not empty allNoneHighlightBlogInfo}">
                <div class="parent">
                    <form action="/blog/by-highlight-get-blogInfo" method="post" id="highlight">
                        <select name="highlight" onchange="document.getElementById('highlight').submit()">
                            <option>请选择</option>
                            <option value="0">未加精</option>
                            <option value="1">已加精</option>
                            <option value="2">公告栏</option>
                        </select>
                    </form>
                </div>

                <div class="parent">
                    <form action="/blog/by-blog-highlight-and-status-get-blogInfo" method="post" id="blogStatus">
                        <select name="blogStatus" onchange="document.getElementById('blogStatus').submit()">
                            <option>请选择</option>
                            <option value="0">未删除</option>
                            <option value="1">已删除</option>
                        </select>
                    </form>
                </div>
                <div>
                    <a href="/blog/blog-add" class="blog-add">添加公告栏</a>
                </div>
                <table>
                    <tr>
                        <th hidden>博客的UUID</th>
                        <th>标签UUID</th>
                        <th>博客标题</th>
                        <th>博客内容</th>
                        <th>博客作者</th>
                        <th>加精</th>
                        <th>博客状态</th>
                        <th>博客发表时间</th>
                        <th>表修改时间</th>
                    </tr>
                    <c:forEach items="${allNoneHighlightBlogInfo}" var="b">
                        <tr>
                            <td hidden><input name="blogUuid" value="${b.blogUuid}"></td>
                            <td>
                                <a href="/blog/by-blog-uuid-get-none-highlight-blogInfo?highlight=${b.highlight}&blogUuid=${b.blogUuid}">${b.tagName}</a>
                            </td>
                            <td>${b.blogTitle}</td>
                            <td>${b.blogContent}</td>
                            <td>
                                <a href="/user/by-consumer-uuid-get-consumerInfo?consumerUuid=${b.blogAuthor}">${b.consumerName}</a>
                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${b.highlight == 0}">
                                        <option>未加精</option>
                                    </c:when>
                                    <c:when test="${b.highlight == 1}">
                                        <option>已加精</option>
                                    </c:when>
                                    <c:when test="${b.highlight == 2}">
                                        <option>公告栏</option>
                                    </c:when>
                                </c:choose>

                            </td>
                            <td>

                                <c:choose>
                                    <c:when test="${b.blogStatus == 0}">
                                        <option>
                                            未删除
                                        </option>
                                    </c:when>
                                    <c:when test="${b.blogStatus == 1}">
                                        <option>
                                            已删除
                                        </option>
                                    </c:when>
                                </c:choose>
                            </td>
                            <td>${b.blogPostDate}</td>
                            <td>${b.tableUpdateDate}</td>
                        </tr>
                    </c:forEach>
                </table>
                <div class="center">
                    <div class="pagination">
                        <a href="/blog/get-all-blogInfo?pageNum=1">1</a>
                        <a href="/blog/get-all-blogInfo?pageNum=2">2</a>
                        <a href="/blog/get-all-blogInfo?pageNum=3">3</a>
                        <a href="/blog/get-all-blogInfo?pageNum=4">4</a>
                        <a href="/blog/get-all-blogInfo?pageNum=5" class="active">5</a>
                        <a href="/blog/get-all-blogInfo?pageNum=6">6</a>
                        <a href="/blog/get-all-blogInfo?pageNum=7">7</a>
                        <a href="/blog/get-all-blogInfo?pageNum=8">8</a>
                        <a href="/blog/get-all-blogInfo?pageNum=9">9</a>
                    </div>
                </div>
            </c:if>

            <c:if test="${not empty allDocument}">
                <div class="parent">
                    <form action="/document/by-document-status-get-all-document" method="post" id="documentStatus">
                        <select name="documentStatus" onchange="document.getElementById('documentStatus').submit()">
                            <option>请选择</option>
                            <option value="0">未删除</option>
                            <option value="1">已删除</option>
                        </select>
                    </form>
                </div>
                <table>
                    <tr>
                        <th>文件上传的博客</th>
                        <th>文件上传者</th>
                        <th>文件名</th>
                        <th>文件大小</th>
                        <th>文件路径</th>
                        <th>文件下载量</th>
                        <th>文件删除状态</th>
                        <th>表修改时间</th>
                        <th>操作</th>
                    </tr>

                    <c:forEach items="${allDocument}" var="d">
                        <tr>
                            <form action="/document/update-document-status" method="post">
                                <td class="data">
                                    <input name="DocumentBlogUuid" value="${d.documentBlogUuid}" hidden="hidden">
                                    <a href="/blog/by-blog-uuid-get-none-highlight-blogInfo?blogUuid=${d.documentBlogUuid}">${d.blogTitle}</a>
                                </td>
                                <td class="data">
                                    <a href="/user/by-consumer-uuid-get-consumerInfo?consumerUuid=${d.documentConsumerUuid}">
                                            ${d.consumerName}
                                </td>
                                <td class="data">${d.documentName}</td>
                                <td class="data">${d.documentSize}</td>
                                <td class="data"><a href="${d.documentPath}">${d.documentPath}</a></td>
                                <td class="data">${d.documentDownloadCount}</td>
                                <td class="data">
                                    <select name="DocumentStatus">
                                        <c:choose>
                                            <c:when test="${d.documentStatus == 0}">
                                                <option value="0">未删除</option>
                                            </c:when>
                                            <c:when test="${d.documentStatus == 1}">
                                                <option value="1">已删除</option>
                                            </c:when>
                                        </c:choose>
                                        <option>请选择</option>
                                        <option value="0">未删除</option>
                                        <option value="1">已删除</option>
                                    </select>
                                </td>
                                <td class="data">${d.tableUpdateDate}</td>
                                <td class="data">
                                    <input type="submit" value="更改">
                                </td>
                            </form>
                        </tr>
                    </c:forEach>
                </table>
                <div class="center">
                    <div class="pagination">
                        <a href="/document/get-all-document?pageNum=1">1</a>
                        <a href="/document/get-all-document?pageNum=2">2</a>
                        <a href="/document/get-all-document?pageNum=3">3</a>
                        <a href="/document/get-all-document?pageNum=4">4</a>
                        <a href="/document/get-all-document?pageNum=5" class="active">5</a>
                        <a href="/document/get-all-document?pageNum=6">6</a>
                        <a href="/document/get-all-document?pageNum=7">7</a>
                        <a href="/document/get-all-document?pageNum=8">8</a>
                        <a href="/document/get-all-document ?pageNum=9">9</a>
                    </div>
                </div>
            </c:if>

            <c:if test="${not empty allReportInfo}">
                <div class="parent">
                    <form action="/report/by-report-status-get-all-reportInfo" method="post" id="reportStatus">
                        <select name="reportStatus" onchange="document.getElementById('reportStatus').submit()">
                            <option>请选择</option>
                            <option value="1">已举报</option>
                            <option value="2">已处理</option>
                        </select>
                    </form>
                </div>
                <table>
                    <tr>
                        <th hidden>被举报博客UUID</th>
                        <th>举报的博客标题</th>
                        <th>举报人</th>
                        <th>举报内容</th>
                        <th>举报状态</th>
                        <th>举报时间</th>
                        <th>表修改时间</th>
                        <th>操作</th>
                    </tr>

                    <c:forEach items="${allReportInfo}" var="r">
                        <tr>
                            <form action="/report/update-report-status" method="post">
                                <td hidden>
                                    <input name="blogUuid" value="${r.blogUuid}" hidden>
                                </td>
                                <td>
                                    <a href="/blog/by-blog-uuid-get-none-highlight-blogInfo?blogUuid=${r.blogUuid}">${r.blogTitle}</a>
                                </td>
                                <td>
                                    <a href="/user/by-consumer-uuid-get-consumerInfo?consumerUuid=${r.reportUuid}">${r.consumerName}</a>
                                </td>
                                <td>
                                        ${r.reportContent}
                                </td>
                                    <%--                                <a href="/report/by-report-uuid-and-blog-uuid-get-reportInfo?reportUuid=${r.reportUuid}&blogUuid=${r.blogUuid}"></a>--%>
                                <td>
                                    <select name="reportStatus">
                                        <c:choose>
                                            <c:when test="${r.reportStatus == 1}">
                                                <option value="1">已举报</option>
                                            </c:when>
                                            <c:when test="${r.reportStatus == 2}">
                                                <option value="2">已处理</option>
                                            </c:when>
                                        </c:choose>
                                        <option>请选择</option>
                                        <option value="1">已举报</option>
                                        <option value="2">已处理</option>
                                    </select>

                                </td>
                                <td>${r.reportDate}</td>
                                <td>${r.tableUpdateDate}</td>
                                <td><input type="submit" value="处理"></td>
                            </form>
                        </tr>
                    </c:forEach>
                </table>
                <div class="center">
                    <div class="pagination">
                        <a href="/report/get-all-reportInfo?pageNum=1">1</a>
                        <a href="/report/get-all-reportInfo?pageNum=2">2</a>
                        <a href="/report/get-all-reportInfo?pageNum=3">3</a>
                        <a href="/report/get-all-reportInfo?pageNum=4">4</a>
                        <a href="/report/get-all-reportInfo?pageNum=5" class="active">5</a>
                        <a href="/report/get-all-reportInfo?pageNum=6">6</a>
                        <a href="/report/get-all-reportInfo?pageNum=7">7</a>
                        <a href="/report/get-all-reportInfo?pageNum=8">8</a>
                        <a href="/report/get-all-reportInfo?pageNum=9">9</a>
                    </div>
                </div>
            </c:if>
        </div>
    </div>
</div>
</body>
<style>
    body {
        /*background-image: url("/static/img/kb.jpg");*/
        background-color: #79A1E6;
    }

    .middle1-search {
        margin-left: 4%;
        height: 38px;
        width: 500px;
        /*position: absolute;*/
        right: 202px;
        border-radius: 30px;
        font-size: 14px;
        color: rgb(153, 153, 153);
        background-color: rgb(235, 236, 237);
        border: none;
    }

    .middle1-search:focus {
        outline: none;
        box-shadow: 0 0 0 1.5px #f7941d;
    }

    .middle1-submit {
        height: 38px;
        width: 5%;
        right: 202px;
        border-radius: 30px;
        font-size: 14px;
        background-color: rgb(235, 236, 237);
        border: none;
    }

    .middle1-submit:focus {
        outline: none;
        box-shadow: 0 0 0 1.5px #f7941d;
    }


    .middle1-tag {
        margin-left: 63%;
        height: 3%;
        width: 10%;
        /*position: absolute;*/
        right: 202px;
        border-radius: 30px;
        font-size: 14px;
        color: rgb(153, 153, 153);
        background-color: rgb(235, 236, 237);
        border: none;
    }

    .middle1-tag-submit {
        margin-left: 1em;
        height: 3%;
        width: 5%;
        /*position: absolute;*/
        right: 202px;
        border-radius: 30px;
        font-size: 14px;
        background-color: rgb(235, 236, 237);
        border: none;
    }

    .middle1-tag-submit:focus {
        outline: none;
        box-shadow: 0 0 0 1.5px #f7941d;
    }


    /* 未被访问的链接 */
    a:link {
        color: red;
        text-decoration: none;
    }

    /* 已被访问的链接 */
    a:visited {
        color: green;
        text-decoration: none;
    }

    /* 将鼠标悬停在链接上 */
    a:hover {
        color: hotpink;
        text-decoration: none;
    }

    /* 被选择的链接 */
    a:active {
        color: blue;
        text-decoration: none;
    }

    .home {
        padding-top: 10%;
    }

    .home a {
        font-size: 25px;
    }


    body {
        margin: 0;
    }

    /*导航栏*/
    #navigation {
        float: right;
    }

    ul {
        list-style-type: none;
        margin-top: 0;
        padding: 0;
        width: 7%;
        background-color: #79A1E6;
        position: fixed;
        height: 100%;
        overflow: auto;
    }

    li a {
        display: block;
        color: #000;
        padding: 8px 16px;
        text-decoration: none;
    }

    li a.active {
        background-color: #4CAF50;
        color: white;
    }

    li a:hover:not(.active) {
        background-color: #555;
        color: white;
    }


    * {
        box-sizing: border-box;
    }





    table {
        width: 90%;
        background: #79A1E6;
        margin: 10px auto;
        border-collapse: collapse;
        /*border-collapse:collapse合并内外边距
        (去除表格单元格默认的2个像素内外边距*/
    }

    th, td {
        height: 45px;
        line-height: 25px;
        text-align: center;
        border: 1px solid #ccc;
    }

    th {
        background: #eee;
        font-weight: normal;
    }

    tr {
        background: #fff;
    }

    tr:hover {
        background: #79A1E6;
    }

    td a {
        color: #06f;
        text-decoration: none;
    }

    td a:hover {
        color: #06f;
        text-decoration: underline;
    }


    .parent {
        /*background: url('yourimage') no-repeat;*/
        float: left;
        margin-left: 5%;
        margin-bottom: 5px;
        width: 150px;
        height: 25px;
        background-color: #eeeeee;
    }

    .parent input {
        float: right;
    }

    .parent select {
        border: none;
        padding-left: 10px;
        width: 150px;
        height: 100%;
        -webkit-appearance: none; /* Safari 和 Chrome */
        -moz-appearance: none; /* Firefox */
        background: transparent;
    }


    .admin-add, .blog-add {
        padding-left: 58%;
    }


    /* 设置下拉按钮的样式 */
    .dropbtn {
        background-color: #79A1E6;
        color: white;
        padding: 16px;
        font-size: 16px;
        border: none;
        cursor: pointer;
    }

    /* 容器 <div> - 需要放置下拉内容 */
    .dropdown {
        position: relative;
        display: inline-block;
    }

    /* 下拉内容（默认隐藏） */
    .dropdown-content {
        display: none;
        position: absolute;
        background-color: #79A1E6;
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
        z-index: 1;
    }

    /* 下拉链接 */
    .dropdown-content a {
        color: black;
        padding: 12px 16px;
        text-decoration: none;
        display: block;
    }

    /* 悬停时更改下拉链接的颜色 */
    .dropdown-content a:hover {
        background-color: #f1f1f1
    }

    /* 悬停时显示下拉菜单 */
    .dropdown:hover .dropdown-content {
        display: block;
    }

    /* 显示下拉内容时，更改下拉按钮的背景颜色 */
    .dropdown:hover .dropbtn {
        background-color: #79A1E6;
    }

    .user{
        padding-bottom: 2%;
    }
</style>
</html>
